com.livecode.assert
Type
module
Summary
Sometimes there are restrictions about how some LCB code can be used correctly. It may only be possible to make it work in a sensible way if is passed a particular range of values, or if the system is in a particular state. These are known as "preconditions" for the code.
Many preconditions can be expressed via the LCB type system. For
example, you can declare that the parameters passed to handler must be
particular types of value. For example, when you write in pName as String
, you are saying that the handler can only work when the
pName
parameter is a character string. This is a precondition that
can be checked automatically by the LCB compiler and virtual machine.
Some preconditions can't yet be automatically checked by LCB. An example would be a requirement that a string contains only ASCII characters, or that an array has a particular key.
This module provides syntax to assist with explicit precondition checks.
Description
Sometimes there are restrictions about how some LCB code can be used correctly. It may only be possible to make it work in a sensible way if is passed a particular range of values, or if the system is in a particular state. These are known as "preconditions" for the code.
Many preconditions can be expressed via the LCB type system. For
example, you can declare that the parameters passed to handler must be
particular types of value. For example, when you write in pName as String
, you are saying that the handler can only work when the
pName
parameter is a character string. This is a precondition that
can be checked automatically by the LCB compiler and virtual machine.
Some preconditions can't yet be automatically checked by LCB. An example would be a requirement that a string contains only ASCII characters, or that an array has a particular key.
This module provides syntax to assist with explicit precondition checks.